package com.ms.service.module.fish.message.server;

import java.nio.ByteBuffer;

import com.ms.service.module.fish.game.GameUser;
import com.ms.service.module.fish.message.FishBaseMessage;

/**
 * 炮弹攻击
 * @author cuiwm
 */
public class AttackMessage extends FishBaseMessage {
	
	private GameUser user;
	private int battery;
	private int x;
	private int y;
	private int lostCoin;
    
    public AttackMessage(GameUser user,int battery,int lostCoin,int x,int y) {
    	this.user = user;
    	this.battery = battery;
    	this.lostCoin = lostCoin;
    	this.x = x;
    	this.y = y;
	}

	public GameUser getUser() {
		return user;
	}

	public void setUser(GameUser user) {
		this.user = user;
	}

	public int getBattery() {
		return battery;
	}

	public void setBattery(int battery) {
		this.battery = battery;
	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

	public int getLostCoin() {
		return lostCoin;
	}

	public void setLostCoin(int lostCoin) {
		this.lostCoin = lostCoin;
	}

	@Override
	public void writeBody(ByteBuffer buf) {
		writeString(buf, user.getId().toString());
		buf.put((byte) battery);
		buf.putInt(lostCoin);
		buf.putInt(x);
		buf.putInt(y);
	}

    

}